package com.pavco.caribbeanvisit.client.event;

import java.util.ArrayList;

import com.google.gwt.event.shared.GwtEvent;
import com.pavco.caribbeanvisit.client.eventhandlers.ReceivedTagsEventHandler;

public class ReceivedTagsEvent extends GwtEvent<ReceivedTagsEventHandler> {
  
  public static final GwtEvent.Type<ReceivedTagsEventHandler> TYPE =
      new GwtEvent.Type<ReceivedTagsEventHandler> ();

  private ArrayList<String> tags;
  private Throwable caught;
  
  @Override
  protected void dispatch(ReceivedTagsEventHandler handler) {
    handler.onReceived(this);
  }

  @Override
  public GwtEvent.Type<ReceivedTagsEventHandler> getAssociatedType() {
    return TYPE;
  }

  public boolean isFailed() {
    return (caught != null);
  }
  
  public void setError(Throwable caught) {
    this.setError(caught);
  }

  public Throwable getError() {
    return caught;
  }
  
  public void setTags(ArrayList<String> tags) {
    this.tags = tags;
  }
  
  public ArrayList<String> getTags() {
    return tags;
  }
}